#-------------------------------------------------------------------------------
# Name:        Base
# Purpose:
#
# Author:      Pablo
#
# Created:     17/09/2013
# Copyright:   (c) Monxcleyr Productions 2013
# Licence:     GPL v3
#-------------------------------------------------------------------------------
#!/usr/bin/env python

import pygame, logging

class Base():

  """Most basic object class"""

  def __init__(self, objtype, name, attributes, imagehandler):
    self.type = objtype
    self.name = name
    self.attributes = attributes
    self.attributes['pos'] = self.getfloat_tuple(self.attributes['pos'])
    self.attributes['visable'] = self.attributes['visable'] == 'True'
    self.attributes['priority'] = int(self.attributes['priority'])
    self.imagehandler = imagehandler
    self.ancestors = ['base']


    logging.info('Initialized %s object "%s"', self.type, self.name)


  def getfloat_tuple(self, term):

    """ Returns Returns a tuple of ints"""

    term = term.split(",")

    temp = []
    for item in term:
      temp.append(float(item))

    returntuple = tuple(temp)

    return returntuple


  def draw(self, surface, offset, common):
    """ for testing"""
    pass

  def update(self):
    """ THIS PAGE INTENTIONALLY LEFT BLANK. Also classes can extend on this, wooooooo """


  def move(self, offset):

    """ move the object by offset. """

    pos = self.attributes['pos']

    self.attributes['pos'] = (pos[0] + offset[0], pos[1] + offset[1])